package database_beans;
// Generated Feb 13, 2014 2:57:58 AM by Hibernate Tools 3.6.0


import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

/**
 * Student generated by hbm2java
 */
@Entity
@Table(name="student"
    ,catalog="pia"
    , uniqueConstraints = @UniqueConstraint(columnNames="indeks") 
)
public class Student  implements java.io.Serializable {


     private int idKorisnik;
     private Korisnik korisnik;
     private String indeks;
     private char tip;
     private String adresa;
     private String telefon;
     private String status;
     private Set<Prijava> prijavas = new HashSet<Prijava>(0);
     private Set<Raspored> rasporeds = new HashSet<Raspored>(0);

    public Student() {
    }

	
    public Student(Korisnik korisnik, String indeks, char tip, String adresa, String telefon, String status) {
        this.korisnik = korisnik;
        this.indeks = indeks;
        this.tip = tip;
        this.adresa = adresa;
        this.telefon = telefon;
        this.status = status;
    }
    public Student(Korisnik korisnik, String indeks, char tip, String adresa, String telefon, String status, Set<Prijava> prijavas, Set<Raspored> rasporeds) {
       this.korisnik = korisnik;
       this.indeks = indeks;
       this.tip = tip;
       this.adresa = adresa;
       this.telefon = telefon;
       this.status = status;
       this.prijavas = prijavas;
       this.rasporeds = rasporeds;
    }
   
     @GenericGenerator(name="generator", strategy="foreign", parameters=@Parameter(name="property", value="korisnik"))@Id @GeneratedValue(generator="generator")

    
    @Column(name="id_korisnik", unique=true, nullable=false)
    public int getIdKorisnik() {
        return this.idKorisnik;
    }
    
    public void setIdKorisnik(int idKorisnik) {
        this.idKorisnik = idKorisnik;
    }

@OneToOne(fetch=FetchType.LAZY)@PrimaryKeyJoinColumn
    public Korisnik getKorisnik() {
        return this.korisnik;
    }
    
    public void setKorisnik(Korisnik korisnik) {
        this.korisnik = korisnik;
    }

    
    @Column(name="indeks", unique=true, nullable=false, length=45)
    public String getIndeks() {
        return this.indeks;
    }
    
    public void setIndeks(String indeks) {
        this.indeks = indeks;
    }

    
    @Column(name="tip", nullable=false, length=1)
    public char getTip() {
        return this.tip;
    }
    
    public void setTip(char tip) {
        this.tip = tip;
    }

    
    @Column(name="adresa", nullable=false, length=45)
    public String getAdresa() {
        return this.adresa;
    }
    
    public void setAdresa(String adresa) {
        this.adresa = adresa;
    }

    
    @Column(name="telefon", nullable=false, length=45)
    public String getTelefon() {
        return this.telefon;
    }
    
    public void setTelefon(String telefon) {
        this.telefon = telefon;
    }

    
    @Column(name="status", nullable=false, length=45)
    public String getStatus() {
        return this.status;
    }
    
    public void setStatus(String status) {
        this.status = status;
    }

@OneToMany(fetch=FetchType.LAZY, mappedBy="student")
    public Set<Prijava> getPrijavas() {
        return this.prijavas;
    }
    
    public void setPrijavas(Set<Prijava> prijavas) {
        this.prijavas = prijavas;
    }

@OneToMany(fetch=FetchType.LAZY, mappedBy="student")
    public Set<Raspored> getRasporeds() {
        return this.rasporeds;
    }
    
    public void setRasporeds(Set<Raspored> rasporeds) {
        this.rasporeds = rasporeds;
    }

    @Override
    public String toString() {
        return korisnik.getIme() + " " + korisnik.getPrezime();
    }
    
    



}


